package com.wj.crm.controller;

import com.wj.crm.base.BaseController;
import com.wj.crm.dao.CustomerMapper;
import com.wj.crm.query.CustomerContactQuery;
import com.wj.crm.query.OrderDetailsQuery;
import com.wj.crm.service.CustomerContactService;
import com.wj.crm.service.CustomerService;
import com.wj.crm.vo.CustomerContact;
import com.wj.crm.vo.CustomerServe;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @author WangJin
 * @version 1.0
 * @date 2022/2/10 12:08
 */
@Controller
@RequestMapping("customer_contact")
public class CustomerContactController extends BaseController {
    @Autowired
    private CustomerContactService customerContactService;

    @Autowired
    private CustomerService customerService;


    @RequestMapping("list")
    @ResponseBody
    public Map<String,Object> queryCustomerContactByParams(CustomerContactQuery customerContactQuery){

        return customerContactService.queryCustomerContactByParams(customerContactQuery);
    }


    @RequestMapping("toCustomerContactPage")
    public String toCustomerContactPage(Integer cusId, Model model){

        model.addAttribute("customer",customerService.selectByPrimaryKey(cusId));
        CustomerContact customerContact = customerContactService.selectByPrimaryKey(cusId);
        model.addAttribute("customerContact",customerContact);
        return "customer/customer_contact";
    }
}
